package com.yugu.park.config;

import com.yugu.enums.LotteryConstants;
import com.yugu.enums.SysRedisConstants;
import com.yugu.util.StringUtils;

public class RedisKeyManager {


    /**
     * 获取抽奖活动的key
     *
     * @param id
     * @return
     */
    public static String getLotteryRedisKey(String id) {
        return new StringBuilder(LotteryConstants.LOTTERY).append(":").append(id).toString();
    }

    /**
     * 获取指定活动下的所有奖品数据
     *
     * @param lotteryId
     * @return
     */
    public static String getLotteryPrizeRedisKey(String lotteryId) {
        return new StringBuilder(LotteryConstants.LOTTERY_PRIZE).append(":").append(lotteryId).toString();
    }

    public static String getLotteryPrizeRedisKey(String lotteryId, String prizeId) {
        return new StringBuilder(LotteryConstants.LOTTERY_PRIZE).append(":").append(lotteryId).append(":").append(prizeId).toString();
    }

    public static String getDefaultLotteryPrizeRedisKey(String lotteryId) {
        return new StringBuilder(LotteryConstants.DEFAULT_LOTTERY_PRIZE).append(":").append(lotteryId).toString();
    }

    public static String getLotteryItemRedisKey(String lotteryId) {
        return new StringBuilder(LotteryConstants.LOTTERY_MATTER_DETAIL).append(":").append(lotteryId).toString();
    }

    public static String getDefaultLotteryItemRedisKey(String lotteryId) {
        return new StringBuilder(LotteryConstants.DEFAULT_LOTTERY_DETAIL).append(":").append(lotteryId).toString();
    }
    public static String getDriverRedisKey(String shopId,String driverId) {
    	StringBuffer sb = new StringBuffer(SysRedisConstants.DRIVER_KEY);
    	if(StringUtils.isNotEmpty(shopId)) {
    		sb.append(":").append(shopId);
    	}
    	if(StringUtils.isNotEmpty(driverId)) {
    		sb.append(":").append(driverId);
    	}
        return sb.toString();
    }
    public static String getFranchiseeKey(String cityCode) {
    	StringBuffer sb = new StringBuffer(SysRedisConstants.FRANCHISEE_KEY);
    	if(StringUtils.isNotEmpty(cityCode)) {
    		sb.append(":").append(cityCode);
    	}
        return sb.toString();
    }

}
